﻿var instertPic = function(){
	
}
instertPic.GetState=function() {
        return FCK_TRISTATE_OFF; //we dont want the button to be toggled
}
var ShowImg = window.parent.ShowImg;
var basePath = window.parent.context+"/content/docmanage/previewImg.jsp?filePath=";
instertPic.Execute=function() {


	ShowImg.showDialog();
  	ShowImg.getSelected = function (arr) {
  		//TODO
		for (var i = 0; i < arr.length; i ++) {
			var path = basePath+encodeURI(arr[i]);
			var html = "<img src =\"";
			html+=path;
			html+="\" />";
			FCK.InsertHtml(html);
		}
	}
}


// Register the related commands.
FCKCommands.RegisterCommand('Pic_Selecter',instertPic) ;

var instertPicItem = new FCKToolbarButton('Pic_Selecter', FCKLang['selectPic']);
instertPicItem.IconPath = FCKConfig.PluginsPath + 'fileselecter/pic.gif'; //specifies the image used in the toolbar

FCKToolbarItems.RegisterItem('Pic_Selecter', instertPicItem );
